<template>
	<view class="list-scroll">
		<view class="list-scroll-item" v-for="(item,index) in postData" :key="index" @click="jumpTo(index,'post')">
			<view class="s-item-head   text-xl">

				<view class="basis-lg  margin-xs flex align-center text-over  text-xl">{{item.name}}</view>
				<view class="basis-sm  margin-xs flex align-center text-over text-right text-xl  text-blue text-bold">
					{{pricePrint(item.min_price)}}-{{pricePrint(item.max_price)}}
				</view>

			</view>
			<view class="s-item-head  text-xl  flex flex-wrap">

				<view class="basis-xl  margin-xs flex align-center   text-xl">

					<view class='cu-tag radius tag-style' v-for="(tag,i) in item.skill" v-if="tag.length>0 && isArray(item.skill)" >{{tag}}</view>
					<view class='cu-tag radius tag-style' >{{item.school || "学历不限"}}</view>
				</view>
				

			<!-- <view class="basis-xll margin-xs  flex align-center  tag-style text-flow" v-else>
			         {{item.desc}}
				</view>
			 -->

				
				
				
			</view>
			<view class="flex margin-top s-item-head  text-xl  " v-if="item.company">
				<view class="cu-avatar radius lsg " v-if="item.company.logo"
					:style="{backgroundImage:'url('+isNull(item.company.logo)+')'}">
				</view>

				<view class="cu-avatar radius lsg " v-else :style="{backgroundImage:'url('+defalutLogo+')'}">

				</view>

				<view class="item-bottom  flex flex-direction  justify-around">

					<view class="text-cut ">{{item.company.name}}</view>

					<view class="flex text-gray">
						<view class="text-cut basis-xl text-over">{{item.company.industry}}</view>
						<view class="basis-xs">
							| {{item.company.min_scale}}-{{item.company.max_scale}} 人</view>
					</view>


				</view>


			</view>
			<view class="flex margin-top s-item-head justify-end  text-xl  " v-if="item.city">
			 
			  <text class="text-gray ">{{item.city || ""}} {{item.address || ""}}</text> 
			</view>

		</view>




	</view>
</template>

<script>
	export default {
		name: "PostList",
		props: {
			postData: {
				type: Array,
				default: {}
			}
		},
		data() {
			return {
				defalutLogo: this.resDomain+"/Offer/static/enter.png"
			}
		},
		watch: {
			postData(val) {
				this.postData = val;
			}
		},

		methods: {
			isArray(arr){
				let str=true;
				if(typeof arr=="string"){
					str=false;
				}
				return str;
			},
			isNull(param) {
				return param ? param : this.defalutLogo;
			},
			pricePrint(num) {
				return (num / 1000) + "k";

			},

			jumpTo(index) {
				//this.$emit('clickItem', index, 'post');
				uni.navigateTo({
					url: "/app/Offer/pages/index/postInfo?offer_id=" + this.postData[index].offer_id
				})
				
				
			}
		}



	}
</script>
<style scoped>
	/**
	 * 列表样式
	 */
	.list-scroll {
		width: 92%;
		margin: 0 auto;
	}

	.list-scroll-item {
		width: 100%;
		min-height: 200upx;
		background: #FFFFFF;
		margin-top: 20upx;
		box-shadow: 0px 0px 10upx 0px rgba(0, 0, 0, 0.05);
		border-radius: 20upx;
		display: flex;
		flex-direction: column;
		padding: 40upx 30upx;
	}

	.s-item-head {
		width: 100%;
		display: flex;
		flex-direction: row;
		white-space: nowrap;
		text-overflow: ellipsis;
		overflow: hidden;
		font-size: 30upx;

		color: #333333;

	}

	.tag {
		margin-right: 10upx;
		border-radius: 4upx;
		font-size: 20upx;
		font-weight: bold;
		height: 40upx;
		min-width: 60upx;
		text-align: center;
	}

	.s-item-body {
		width: 100%;
		height: 40upx;
		margin-top: 10upx;
		line-height: 40upx;
		display: flex;
		flex-direction: row;
		position: relative;
	}

	.s-item-body-tab {
		width: 30%;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;

	}

	.text-gray {
		padding-right: 5upx;
		opacity: 0.5;
	}

	.s-item-body-right {
		position: absolute;
		float: right;
		right: 0;
		width: 40%;
		text-align: right;
	}

	.xinzi {
		font-size: 36upx;
		font-weight: 800;
		color: #1270E0;
		padding-right: 5upx;
	}

	.s-item-foot {
		width: 100%;
		height: 40upx;
		line-height: 40upx;
		margin-top: 10upx;
		font-size: 24upx;
		font-weight: 500;
		color: #999999;
		display: flex;
		flex-direction: row;
	}

	.s-item-foot-l {
		width: 70%;
		text-overflow: ellipsis;
		overflow: hidden;
		white-space: nowrap;
	}

	.s-item-foot-r {
		width: 30%;
		text-align: right;
	}

	.text-over {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		display: block;
	}

	.cu-avatar.lsg {
		width: 76upx;
		height: 76upx;
		font-size: 2em;
	}

	.cu-list-box {
		width: 92%;
		margin: auto;
	}

	.tag-style {
		color: #838383;
	}
	.text-flow{
		word-break: break-all;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient:vertical;
		-webkit-line-clamp:2;
		overflow: hidden;
	}
</style>

<style lang="scss">
	.item-bottom {
		margin-left: 20rpx;
		width: 750*0.92-60-96rpx;
	}
</style>
